<template>
        <Card  title="欢迎登陆" class="border-0" header-class="bg-white" footer-class="bg-white">
            <template v-slot:header>
                <h3>欢迎登陆</h3>
            </template>
            <CardForm text="登 录" @submit="login"></CardForm>
            <template v-slot:footer>
                <!-- <button class="btn btn-link text-secondary" @click="setUserState(-1)">如果您还没有账户，请点击此处注册</button> -->
                <router-link to="/home" class="btn btn-link text-secondary" >如果您还没有账户，请点击此处注册</router-link>
            </template>
        </Card>
</template>
<script>
import Card from '@/components/Card';
import CardForm  from '@/components/CardForm';

export default {
    name:'Login',
    components:{
        Card,
        CardForm
    },
     methods:{
        login(username, password) {
            const user=this.$store.state.user
            if (username ==user.username && password ==user.password) {
                alert("登录成功");
                this.$router.push({path:'/home'})
            } else {
                alert("登录失败,请重新登录")
            }
        }
     }
}
</script>